int screen[];
int movie[][];
boolean film;
boolean play;
int i, j;

DB db1;

String data;
String[] data2;
void setup(){
  size(400, 400);
  rectMode(RADIUS);
  screen = new int[width*height];
  i = j = 0;
  film = false;
  db1 = new DB("pong", "root", "1234");
  data = "";
  data2 = new String[1000];
}

void draw(){
  fill(0);
  if (mousePressed){
    ellipse(mouseX, mouseY, 5, 5);
  }
  if (film && i < 1000){
    data = "";
    for (int k = 0; k < screen.length; k++) data += screen[k] + ",";
    data = data.substring(0, data.length() - 1);
    data2[i] = data;
    i++;
  }  
}

void keyReleased(){
  if (key == 'a')
    preserveScreen();
  else if (key == 'b')
    restoreScreen();
}

void preserveScreen() {
  loadPixels();   // <-- HERE ME CHANGEY GOODNESS
  for (int i = 0; i < width*height; i++) {
    screen[i] = pixels[i];
  }
}
void restoreScreen() {
  for (int i = 0; i < width*height; i++) {
    pixels[i] = screen[i];
  }
  updatePixels();   // <-- HERE ME CHANGEY GOODNESS
}
